package com.pc.tas.region;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface RegionMapper {	
	
	@Insert("insert into t_region (id,columnName, parentId, attrs,hasChildren) values (#{id},#{columnName},#{parentId},#{attrs},#{hasChildren})")
	public void insert(Region region);
	
	@Update("update t_region set columnName = #{columnName}, parentId = #{parentId}, attrs = #{attrs},hasChildren = #{hasChildren} where id = #{id}")
	public void update(Region region);
	
	@Delete("delete from t_region where id = #{id}")
	public void delete(String id);
	
	@Select("select * from t_region where id = #{id}")
	public Region getById(String id);
	
	@Select("select * from t_region where parentid = #{parentId}")
	public List<Region> getByParentId(String parentId);
}
